#{extends 'main.html' /}
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Edit</title>
</head>

<script type="text/javascript">
window.onload = SelectElement;

function SelectElement()
{    
	
	var element = document.getElementById('no_of_change_per_month');
	var number = document.getElementById('number_of_changes');
	//alert(number.value);
    element.value =number.value ;
}


function isNumberKey(evt)
{
   var charCode = (evt.which) ? evt.which : event.keyCode;
   if (charCode != 46 && charCode > 31 
     && (charCode < 48 || charCode > 57))
      return false;

   return true;
}

	function fill1() {

		var total_price = document.getElementsByName("total1_price");

		var quantity = document.getElementsByName("quantity1");
		var price = document.getElementsByName("item1_price");

		var result = quantity[0].value * price[0].value;
		total_price[0].value = result;

	}
	function fill2() {

		var total_price = document.getElementsByName("total2_price");

		var quantity = document.getElementsByName("quantity2");
		var price = document.getElementsByName("item2_price");

		var result = quantity[0].value * price[0].value;
		total_price[0].value = result;

	}
	function fill3() {

		var total_price = document.getElementsByName("total3_price");

		var quantity = document.getElementsByName("quantity3");
		var price = document.getElementsByName("item3_price");

		var result = quantity[0].value * price[0].value;
		total_price[0].value = result;

	}
	function fill4() {

		var total_price = document.getElementsByName("total4_price");

		var quantity = document.getElementsByName("quantity4");
		var price = document.getElementsByName("item4_price");

		var result = quantity[0].value * price[0].value;
		total_price[0].value = result;

	}
	function fill5() {

		var total_price = document.getElementsByName("total5_price");

		var quantity = document.getElementsByName("quantity5");
		var price = document.getElementsByName("item5_price");

		var result = quantity[0].value * price[0].value;
		total_price[0].value = result;

	}
</script>
#{if flash.error}
    <p style="color:#c00">
        ${flash.error}
    </p>
    
    
#{/if}
<body>
<h1>${productList[0].number_of_changes}</h1>

<form action="@{Contracts.save(id)}" method="post"
	enctype="multipart/form-data">
	<input type="hidden" value=${id}>
	
			<table style="" align="center" border="4">
			<tr>
				<td><b> Name 1:</b></td>
				<td><input type="text" name="name1" value=${c.name1} /></td>
			</tr>
			<tr>
				<td><b> Name 2:</b>
				</td>
				<td><input type="text" name="name2" value=${c.name2} />
				</td>
			</tr>

			<tr>
				<td><b> Mobile 1 : </b>
				</td>
				<td><input type="text" name="mobile1"  onkeypress="return isNumberKey(event)"  value=${c.mobile1} />
				</td>
			</tr>
			<tr>
				<td><b> Mobile 2 : </b></td>
				<td><input type="text" name="mobile2"  onkeypress="return isNumberKey(event)"  value=${c.mobile2} /></td>
			</tr>
			<tr>
				<td><b> Phone 1 : </b>
				</td>
				<td><input type="text" name="phone1" onkeypress="return isNumberKey(event)" value=${c.phone1} />
				</td>
			</tr>
			<tr>
				<td><b> Phone 2 : </b>
				</td>
				<td><input type="text" name="phone2" onkeypress="return isNumberKey(event)" value=${c.phone2} />
				</td>
			</tr>

			<tr>
				<td><b>Contract id</b>
				</td>
				<td><input type="text" name="contract_id" onkeypress="return isNumberKey(event)" value=${c.contract_id} />
				</td>
			</tr>
			<tr>
				<td><b>Year </b></td>
				<td><input type="text" name="year" onkeypress="return isNumberKey(event)" value=${c.year} /></td>
			</tr>
			<tr>
				<td><b>Date : </b></td>
				<td><input type="date" name="date" value=${c.date} /></td>
			</tr>

			<tr>
				<td><b>Address : </b></td>
				
				<td><textarea name="address">${c.address}</textarea></td>
				
			</tr>
			<tr>
				<td><b> Area :</b></td>

				<td>
				<select  name="area" >
						<option >A</option>
						<option>B</option>
						<option>C</option>
					
				</select>
				
				</td>
			</tr>

			<tr>
				<td><b> No of change/Month :</b>
				</td>
				<td>
				<input id= "number_of_changes" type="hidden" value=${productList[0].number_of_changes}>
				<select id="no_of_change_per_month" name="no_of_change_per_month">
						<option value="none">none</option>
						<option value="1">1</option>
						<option value="2">2</option>
						<option value="4">4</option>
				</select>
				</td>
			</tr>

			<tr>
				<td><b> Products :</b>
				</td>
			</tr>
			sssssssssssssssssssssssss
			#{list items:productList, as:'product'}
			
			#{/list}
			<tr>
				<td><select name="Product1">
						<option value="none">none</option>
						<option value="Mop18">Mop18</option>
						<option value="Mit">Mit</option>
						<option value="HD1">HD1</option>
						<option value="HD2">HD2</option>
						<option value="Mop36">Mop36</option>

				</select>
				</td>
				<td><b> Quantity :</b> <input type="text" name="quantity1"
					onchange="fill1()" onkeypress="return isNumberKey(event)" /></td>
				<td><b> Price :</b> <input type="text" name="item1_price"
					onchange="fill1()" onkeypress="return isNumberKey(event)" />
				</td>
				<td><b> Total Price :</b> <input type="text"
					name="total1_price" disabled="disabled" />
				</td>
				<td><b> Smell :</b> <select name="smell1">
						<option value="none">none</option>
						<option value="jasmine">ياسمين</option>
						<option value="straw">فرولة</option>
						<option value="lemon">ليمون</option>
						<option value="5o5">خوخ</option>

				</select>
				</td>
				<td><b> Floor Type :</b> <select name="floor_type1"'>
						<option>سيراميك</option>
						<option>بلاط</option>
						<option>HDF</option>

				</select>
				</td>
			</tr>
			<tr>
				<td><select name="Product2">
						<option value="none">none</option>
						<option value="Mop18">Mop18</option>
						<option value="Mit">Mit</option>
						<option value="HD1">HD1</option>
						<option value="HD2">HD2</option>
						<option value="Mop36">Mop36</option>
				</select>
				</td>
				<td><b> Quantity :</b> <input type="text" name="quantity2"
					onchange="fill2()" onkeypress="return isNumberKey(event)"/></td>
				<td><b> Price :</b> <input type="text" name="item2_price"
					onchange="fill2()"onkeypress="return isNumberKey(event)" />
				</td>
				<td><b> Total Price :</b> <input type="text"
					name="total2_price" disabled="disabled" />
				</td>
				<td><b> Smell :</b> <select name="smell2">
						<option value="none">none</option>
						<option value="jasmine">ياسمين</option>
						<option value="straw">فرولة</option>
						<option value="lemon">ليمون</option>
						<option value="5o5">خوخ</option>

				</select></td>
				<td><b> Floor Type :</b> <select name="floor_type2"'>
						<option>سيراميك</option>
						<option>بلاط</option>
						<option>HDF</option>

				</select>
				</td>

			</tr>
			<tr>
				<td><select name="Product3">
						<option value="none">none</option>
						<option value="Mop18">Mop18</option>
						<option value="Mit">Mit</option>
						<option value="HD1">HD1</option>
						<option value="HD2">HD2</option>
						<option value="Mop36">Mop36</option>
				</select>
				</td>
				<td><b> Quantity :</b> <input type="text" name="quantity3"
					onchange="fill3()" onkeypress="return isNumberKey(event)" /></td>
				<td><b> Price :</b> <input type="text" name="item3_price"
					onchange="fill3()" onkeypress="return isNumberKey(event)"/></td>
				<td><b> Total Price :</b> <input type="text"
					name="total3_price" disabled="disabled" /></td>
				<td><b> Smell :</b> <select name="smell3">
						<option value="none">none</option>
						<option value="jasmine">ياسمين</option>
						<option value="straw">فرولة</option>
						<option value="lemon">ليمون</option>
						<option value="5o5">خوخ</option>
				</select></td>
				<td><b> Floor Type :</b> <select name="floor_type3"'>
						<option>سيراميك</option>
						<option>بلاط</option>
						<option>HDF</option>

				</select>
				</td>

			</tr>
			<tr>
				<td><select name="Product4">
						<option value="none">none</option>
						<option value="Mop18">Mop18</option>
						<option value="Mit">Mit</option>
						<option value="HD1">HD1</option>
						<option value="HD2">HD2</option>
						<option value="Mop36">Mop36</option>
				</select>
				</td>
				<td><b> Quantity :</b> <input type="text" name="quantity4"
					onchange="fill4()" onkeypress="return isNumberKey(event)"/></td>
				<td><b> Price :</b> <input type="text" name="item4_price"
					onchange="fill4()" onkeypress="return isNumberKey(event)"/></td>
				<td><b> Total Price :</b> <input type="text"
					name="total4_price" disabled="disabled" />
				</td>
				<td><b> Smell :</b> <select name="smell4">
						<option value="none">none</option>
						<option value="jasmine">ياسمين</option>
						<option value="straw">فرولة</option>
						<option value="lemon">ليمون</option>
						<option value="5o5">خوخ</option>
				</select>
				</td>
				<td><b> Floor Type :</b> <select name="floor_type4"'>
						<option>سيراميك</option>
						<option>بلاط</option>
						<option>HDF</option>

				</select>
				</td>
			</tr>
			<tr>
				<td><select name="Product5">
						<option value="none">none</option>
						<option value="Mop18">Mop18</option>
						<option value="Mit">Mit</option>
						<option value="HD1">HD1</option>
						<option value="HD2">HD2</option>
						<option value="Mop36">Mop36</option>
				</select>
				</td>
				<td><b> Quantity :</b> <input type="text" name="quantity5"
					onchange="fill5()" onkeypress="return isNumberKey(event)"/>
				</td>
				<td><b> Price :</b> <input type="text" name="item5_price"
					onchange="fill5()" onkeypress="return isNumberKey(event)"/>
				</td>
				<td><b> Total Price :</b> <input type="text"
					name="total5_price" disabled="disabled" />
				</td>
				<td><b> Smell :</b> <select name="smell5">
						<option value="none">none</option>
						<option value="jasmine">ياسمين</option>
						<option value="straw">فرولة</option>
						<option value="lemon">ليمون</option>
						<option value="5o5">خوخ</option>
				</select>
				</td>

				<td><b> Floor Type :</b> <select name="floor_type5"'>
						<option>سيراميك</option>
						<option>بلاط</option>
						<option>HDF</option>

				</select>
				</td>
			</tr>

			<tr>
				<td><input type="submit" value="Save" onclick="myFunction()" />
				</td>
			</tr>
		
		</table>
			</form>
		
		

</form>
</body>
</html>